package net.uhuijia.zb.userlivevisitrecord.controller;

import net.uhuijia.user.usermall.persistence.model.UserMall;
import net.uhuijia.vo.ResultMapVo;
import net.uhuijia.vo.zb.UserLiveVisitRecordVo;
import net.uhuijia.zb.userlivevisitrecord.persistence.model.UserLiveVisitRecord;
import net.uhuijia.zb.userlivevisitrecord.persistence.model.UserLiveVisitRecordExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import net.uhuijia.appbase.controller.BaseController;
import net.uhuijia.zb.userlivevisitrecord.service.UserLiveVisitRecordService;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 用户访问直播记录类
 */
@Controller
@RequestMapping(value="/userlivevisitrecord")
public class UserLiveVisitRecordController
     extends BaseController<UserLiveVisitRecordService,UserLiveVisitRecord,UserLiveVisitRecordExample> {
    @Autowired
    private UserLiveVisitRecordService userLiveVisitRecordService;

    /**
     * 首页直播最近访问接口
     * @return
     */
    @RequestMapping(value = "/indexVisitRecord", method = RequestMethod.GET)
    @ResponseBody
    public ResultMapVo<List<UserLiveVisitRecordVo>> indexVisitRecord(){
        UserMall userMall = this.getUserMallByTokenAndDevice();
        List<UserLiveVisitRecordVo> userLiveVisitRecordVos = this.userLiveVisitRecordService.indexVisitRecord(userMall,10);
        return ResultMapVo.ok(userLiveVisitRecordVos);
    }

}